/*    */ package com.zimbra.qa.unittest;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.Domain;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import junit.framework.TestCase;
/*    */ import org.junit.After;
/*    */ import org.junit.Before;
/*    */ import org.junit.Test;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TestDomain
/*    */   extends TestCase
/*    */ {
/* 34 */   private Provisioning mProv = Provisioning.getInstance();
/* 35 */   private String DOMAIN_NAME = "testautporov.domain.com";
/* 36 */   Domain domain = null;
/*    */   
/*    */   @Before
/*    */   public void setUp() throws Exception
/*    */   {
/* 41 */     Map<String, Object> attrs = new HashMap();
/* 42 */     this.domain = this.mProv.createDomain(this.DOMAIN_NAME, attrs);
/* 43 */     assertNotNull(this.domain);
/*    */   }
/*    */   
/*    */   @After
/*    */   public void tearDown()
/*    */     throws Exception
/*    */   {
/* 50 */     if (this.domain != null) {
/* 51 */       this.mProv.deleteDomain(this.domain.getId());
/*    */     }
/*    */   }
/*    */   
/*    */   @Test
/*    */   public void testModifyAutoProvTimeStamp() {
/*    */     try {
/* 58 */       this.domain.setAutoProvLastPolledTimestampAsString("20140328000454.349Z");
/* 59 */       assertEquals("domain has incorrect last prov time stamp", "20140328000454.349Z", this.domain.getAutoProvLastPolledTimestampAsString());
/*    */       
/* 61 */       this.domain.setAutoProvLastPolledTimestampAsString("20140328000454Z");
/* 62 */       assertEquals("domain has incorrect last prov time stamp", "20140328000454Z", this.domain.getAutoProvLastPolledTimestampAsString());
/*    */       
/* 64 */       this.domain.setAutoProvLastPolledTimestampAsString("20140328000454.0Z");
/* 65 */       assertEquals("domain has incorrect last prov time stamp", "20140328000454.0Z", this.domain.getAutoProvLastPolledTimestampAsString());
/*    */     } catch (ServiceException e) {
/* 67 */       fail(e.getMessage());
/*    */     }
/*    */     try {
/* 70 */       this.domain.setAutoProvLastPolledTimestampAsString("20140328000454.123456Z");
/* 71 */       fail("invalid date-time format should cause an exception");
/*    */     }
/*    */     catch (ServiceException e) {
/* 74 */       assertEquals("catching a wrong exception: " + e.getMessage(), e.getCode(), "account.INVALID_ATTR_VALUE");
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/TestDomain.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */